<template>
  <view class="left-window">
    <el-menu
      :default-active="activeIndex"
      class="el-menu-vertical"
      @select="handleSelect"
      background-color="#f5f5f5"
      text-color="#333"
      active-text-color="#007AFF">
      
      <el-menu-item index="/pages/home/home">
        <i class="el-icon-house"></i>
        <span slot="title">首页</span>
      </el-menu-item>
      
      <el-menu-item index="/pages/customer/customer">
        <i class="el-icon-user"></i>
        <span slot="title">客户管理</span>
      </el-menu-item>
      
      <el-menu-item index="/pages/house/house">
        <i class="el-icon-office-building"></i>
        <span slot="title">房屋管理</span>
      </el-menu-item>
    </el-menu>
  </view>
</template>

<script>
export default {
  data() {
    return {
      activeIndex: '/pages/home/home'
    }
  },
  methods: {
    handleSelect(key) {
      // 更新当前激活的菜单项
      this.activeIndex = key;
      
	  console.log('key',key)
	  
      // 导航到对应页面
      uni.navigateTo({
        url: key
      })
    }
  }
}
</script>

<style scoped>
.left-window {
  width: 200rpx;
  height: 100%;
  background-color: #f5f5f5;
  border-right: 1rpx solid #ddd;
}

.el-menu-vertical {
  height: 100%;
  border-right: none;
}
</style>